/* Copyright (c) [Year] [name of copyright holder]
 * [Software Name] is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *      http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package com.gitee.empty_null.core.config;

import com.gitee.empty_null.core.filter.DelegateRequestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.context.request.WebRequestInterceptor;
import org.springframework.web.servlet.HandlerInterceptor;

import java.util.List;

/**
 * @author xuhainan
 * @date 2023/8/23 17:22
 * @region hefei
 */
@AutoConfiguration
@ComponentScan(basePackages = "com.gitee.empty_null.**")
public class ModuleScanConfiguration {

    @Bean
    public DelegateRequestInterceptor delegateRequestInterceptor(
            @Autowired(required = false) List<WebRequestInterceptor> webRequestInterceptors,
            @Autowired(required = false) List<HandlerInterceptor> handlerInterceptors) {
        return new DelegateRequestInterceptor(webRequestInterceptors, handlerInterceptors);
    }

}
